package com.nmcc.app_adherence;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Environment;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;

import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.database.Cursor;
 
public class MySQLiteHelperOtherDatabases
{

    public static final String  DATABASE_FILE_PATH = "/sdcard";
    public static final String  DATABASE_NAME = "0000000000000001";
    public final static String NAME ="name";
    public final static String ADDRESS ="address";
    public final static String CITY ="city";

    SQLiteDatabase db;
    
    public MySQLiteHelperOtherDatabases(final Context context) {
    	String dir = Environment.getExternalStorageDirectory().getPath();
    			File dbfile = new File(dir+"/0000000000000001.db"); 
    			db = SQLiteDatabase.openOrCreateDatabase(dbfile, null);
    			//System.out.println("Its open? "  + db.isOpen());
  			
   }

    
    public String GetHouseNameAndIDForListing(String givenId){
		
	    Cursor cursor = db.rawQuery("SELECT * FROM household2", null);

	    if (cursor.moveToFirst())
	    {
	        //do
	        //{
	           // opcionesMenu.add(cursor.getString(0) + " - " + cursor.getString(1));
	            //Toast.makeText(context, cursor.getString(0) + " - " + cursor.getString(1) , Toast.LENGTH_LONG).show();
	        //} while(cursor.moveToNext());
	    }

	    db.close();  
    	
    	
    	
    	
    	
		String comment;
    	String placename;
    	int housenumber;
    	int id;
    	
    	// 1. get reference to writable DB
    	
		//SQLiteDatabase db = this.getReadableDatabase();
		String valueToReturn="0";
	     // String table = "household2";
	        //String[] columns = {"household_id"};
	        // String where = "household_id='" + givenId +"'";//this is default so its acts as variable to be replaced
	         //String[] args = {"tagname", "tagname", "tagname", "tagname", "tagname"};
	       // Cursor rs = db.query(table, columns, null, null, null, null, null);
	         //if(rs.moveToFirst()){

		        	//placename= rs.getString(rs.getColumnIndex("_place_name"));
		     
		        	//if (id>0)
                    //{
		        		//valueToReturn= placename;
       	          	//} 
		        
               //}  
	         
	  return valueToReturn;

	         //return null;
	 }
	
    
}
